package my.avoskagae.client.presenter;

import my.avoskagae.client.eventbus.MainBus;
import my.avoskagae.client.view.IProductDetailView;
import my.avoskagae.client.view.gwt.ProductDetailView;
import my.avoskagae.model.entity.Product;

import com.mvp4g.client.annotation.Presenter;
import com.mvp4g.client.presenter.BasePresenter;


@Presenter(view = ProductDetailView.class)
public class ProductDetailPresenter extends BasePresenter<IProductDetailView, MainBus> implements IProductDetailPresenter {

	Product currentProduct;
	
	public void onShowCatalog(){
		eventBus.setDetail(view.getWidgetItself());
	}
	
	public void onChangeSelectionProduct(Product newSelectedProduct){
		this.currentProduct = newSelectedProduct;
		view.refreshData(currentProduct);
	}
	
	public void onChangeCatalog(){
		view.refreshData(currentProduct);
	}
}
